<template>
  <Dialog v-model="dialogVisible" title="错误信息" width="500" align-center>
    <div>
      <ns-input
        :readonly="true"
        v-model="errorStr"
        :rows="5"
        type="textarea"
        placeholder=""
        resize="none"
      />
    </div>
    <template #footer>
      <el-button @click="closeDialog">关 闭</el-button>
    </template>
  </Dialog>
</template>
<script lang="ts" setup>
const dialogVisible = ref(false) // 弹窗的是否展示

const errorStr = ref()

/** 打开弹窗 */
const open = async (error: string) => {
  dialogVisible.value = true
  errorStr.value = error
}

defineExpose({ open }) // 提供 open 方法，用于打开弹窗

const emit = defineEmits(['success']) // 定义 success 事件，用于操作成功后的回调

function closeDialog() {
  dialogVisible.value = false
}
</script>
<style lang="scss" scoped></style>
